package com.mdx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mdx.bean.LogBean;
import com.mdx.dao.LogDao;
import com.mdx.service.ILogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

@Service
@Transactional
public class LogServiceImpl extends ServiceImpl<LogDao, LogBean> implements ILogService {
    @Override
    public IPage<LogBean> findByItem(int pageNO, int pageSize, LocalDate start, LocalDate end) {
        IPage<LogBean> page = new Page<>(pageNO,pageSize);
        QueryWrapper wrapper = new QueryWrapper();
        if (start!=null){
            wrapper.ge("f_loginTime",start);
        }
        if (end != null) {
            wrapper.le("f_loginTime", end);
        }
        IPage<LogBean> iPage = this.page(page,wrapper);
        return iPage;
    }

}
